package com.star.controller;

import com.star.entity.Record;
import com.star.result.Result;
import com.star.service.RecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author star
 * @Date 2023/4/3 22:23
 * @PackageName:com.star.controller
 * @ClassName: RecordController
 * @Description: TODO
 * @Version 1.0
 */
@Api(tags = "车俩档案接口")
@RestController
@RequestMapping("record")
public class RecordController {

    @Autowired
    private RecordService service;

    @ApiOperation("根据id查询")
    @GetMapping("/{id}")
    public Result getByIdRecord(@PathVariable int id){
        Record record = service.getById(id);
        return Result.ok(record);
    }

    @ApiOperation("查询所有记录")
    @GetMapping("/list")
    public Result list(){
        List<Record> list = service.list();
        return Result.ok(list);
    }



}
